<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="js/1.4.8/angular.js"></script>
    <style type="text/css">
        body {
            font-size: 1.5em;
        }

        .div {
            background-color: #2a6496;
            width: 780px;
            padding: 8px;
            color: #fff;
        }
    </style>
</head>
<body>
<div class="div" ng-controller="myCtrl">
    <span>{{stu.name}}</span>
    <span>{{stu.sex}}</span>
    <span>{{stu.score}}</span>
    <span>{{stu.title}}</span>
    <br>
</div>

<script type="application/javascript">
    var app = angular.module("app", []);
    app.factory("outData",function () {
        var data = {
            name:'江俊',
            sex:'男',
            score:'100'
        };
        return data;
    });

    // outData添加属性
    app.config(function ($provide) {
        // $delegate服务实例的一个对象
        $provide.decorator("outData",function ($delegate) {
            $delegate.title = "Angular!";
            return $delegate;
        });
    });

    app.controller("myCtrl",["$scope","outData",function ($scope,outData) {
        $scope.stu = outData;
    }]);
</script>
</body>
</html>